package cn.wj.school.cloud.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * @Author: yueding
 * @Description:
 * @Date: Created in 15:26 2018/5/12
 * @Modified By: Copyright(c) cai-inc.com
 */
@Data
public class PageDTO implements Serializable {

    private static final long serialVersionUID = 8397390258683971476L;

    /**
     * 页面大小
     */
    private Integer numPerPage = 10;
    /**
     * 页码
     */
    private Integer pageNum = 1;
    /**
     * 排序字段
     */
    private String orderField = "id";
    /**
     * 正序倒序
     */
    private String orderDirection = "desc";

    /**
     * 查询开始时间
     */
    private Long selBeginDate;

    /**
     * 查询结束时间
     */
    private Long selEndDate;

    /**
     * 权限, 当前登录人的身份
     */
    private String privilege;

    /**
     * 获取分页开始记录数
     *
     * @return
     */
    public int getOffset() {

        return (this.pageNum - 1) * this.numPerPage;
    }

    /**
     * 获取分页limit
     *
     * @return
     */
    public int getLimit() {

        return this.numPerPage;
    }
}
